package com.wu.util.spider.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 */
@Component
@PropertySource(value = "classpath:spider.properties", encoding = "UTF-8")
public class SpiderConfiguration {

    @Value("${spider.base-url}")
    private String baseUrl;
    @Value("${spider.task.sleep}")
    private Integer sleepTime;
    @Value("${spider.poll.core-size}")
    private Integer pollCoreTheadSize;
    @Value("${spider.poll.max-size}")
    private Integer pollMaxTheadSize;
    @Value("${spider.poll.queue-size}")
    private Integer pollQueueSize;
    @Value("${spider.poll.thead-base-name}")
    private String pollTheadBaseName;
    @Value("${spider.save-image}")
    private Boolean isSaveImage;
    @Value("${spider.save-image-path}")
    private String saveImagePath;
    @Value("${spider.save-db}")
    private Boolean isSaveDb;
    @Value("${spider.save-file}")
    private Boolean isSaveFile;
    @Value("${spider.save-file-type}")
    private String saveFileType;

    public String getBaseUrl() {
        return baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    public Integer getSleepTime() {
        return sleepTime;
    }

    public void setSleepTime(Integer sleepTime) {
        this.sleepTime = sleepTime;
    }

    public Integer getPollCoreTheadSize() {
        return pollCoreTheadSize;
    }

    public void setPollCoreTheadSize(Integer pollCoreTheadSize) {
        this.pollCoreTheadSize = pollCoreTheadSize;
    }

    public Integer getPollMaxTheadSize() {
        return pollMaxTheadSize;
    }

    public void setPollMaxTheadSize(Integer pollMaxTheadSize) {
        this.pollMaxTheadSize = pollMaxTheadSize;
    }

    public Integer getPollQueueSize() {
        return pollQueueSize;
    }

    public void setPollQueueSize(Integer pollQueueSize) {
        this.pollQueueSize = pollQueueSize;
    }

    public String getPollTheadBaseName() {
        return pollTheadBaseName;
    }

    public void setPollTheadBaseName(String pollTheadBaseName) {
        this.pollTheadBaseName = pollTheadBaseName;
    }

    public Boolean getSaveImage() {
        return isSaveImage;
    }

    public void setSaveImage(Boolean saveImage) {
        isSaveImage = saveImage;
    }

    public String getSaveImagePath() {
        return saveImagePath;
    }

    public void setSaveImagePath(String saveImagePath) {
        this.saveImagePath = saveImagePath;
    }

    public Boolean getSaveDb() {
        return isSaveDb;
    }

    public void setSaveDb(Boolean saveDb) {
        isSaveDb = saveDb;
    }

    public Boolean getSaveFile() {
        return isSaveFile;
    }

    public void setSaveFile(Boolean saveFile) {
        isSaveFile = saveFile;
    }

    public String getSaveFileType() {
        return saveFileType;
    }

    public void setSaveFileType(String saveFileType) {
        this.saveFileType = saveFileType;
    }

    @Override
    public String toString() {
        return "{" +
                "baseUrl:" + baseUrl +
                ", pollCoreTheadSize:" + pollCoreTheadSize +
                ", pollMaxTheadSize:" + pollMaxTheadSize +
                ", pollQueueSize:" + pollQueueSize +
                ", pollTheadBaseName:" + pollTheadBaseName +
                ", isSaveImage:" + isSaveImage +
                ", saveImagePath:" + saveImagePath +
                ", isSaveDb:" + isSaveDb +
                ", isSaveFile:" + isSaveFile +
                ", saveFileType:" + saveFileType +
                '}';
    }
}
